import Mock from 'mockjs'
const top = [{
  label: "首页",
  path: "/wel/index",
  icon: 'el-icon-document',
  meta: {
    i18n: 'dashboard',
  },
  parentId: 0
},
// {
//   label: "官网",
//   icon: 'el-icon-document',
//   meta: {
//     menu: false,
//     i18n: 'website',
//   },
//   path: "https://avuejs.com",
//   parentId: 1
// },
// {
//   label: "测试",
//   icon: 'el-icon-document',
//   path: "/test/index",
//   meta: {
//     i18n: 'test',
//   },
//   parentId: 2
// },
// {
//   label: "更多",
//   icon: 'el-icon-document',
//   path: "/wel/dashboard",
//   meta: {
//     menu: false,
//     i18n: 'more',
//   },
//   parentId: 3
// }
]
// if (condition) {

// }
const first = [
  {
    label: "商户管理",
    path: '/merchant',
    component: 'views/util/merchant',
    icon: 'icon-caidan',
    meta: {
      i18n: 'merchant',
    },
    children: []
  },
  {
    label: "订单管理",
    path: '/orderList',
    component: 'views/util/orderList',
    icon: 'icon-caidan',
    meta: {
      i18n: 'orderList',
    },
    children: []
  },
  {
    label: "用户扫码管理",
    path: '/userManagement',
    component: 'views/util/userManagement',
    icon: 'icon-caidan',
    meta: {
      i18n: 'userManagement',
    },
    children: []
  },
  {
    label: "商品",
    path: '/commodity',
    meta: {
      i18n: 'commodity',
    },
    icon: 'icon-caidan',
    children: [
      {
        label: "商品管理",
        path: 'manage',
        meta: {
          i18n: 'manage',
        },
        component: 'views/util/commodity/manage',
        icon: 'icon-caidan',
        children: []
      },
      {
        label: "售后服务",
        path: 'Aftermarket',
        meta: {
          i18n: 'Aftermarket',
        },
        component: 'views/util/commodity/Aftermarket',
        icon: 'icon-caidan',
        children: []
      }
    ]
  },
  {
    label: "销售",
    path: '/sale',
    meta: {
      i18n: 'sale',
    },
    icon: 'icon-caidan',
    children: [
      {
        label: "销售数据",
        path: 'record',
        meta: {
          i18n: 'record',
        },
        component: 'views/util/sale/record',
        icon: 'icon-caidan',
        children: []
      },
      {
        label: "订单详情",
        path: 'order',
        meta: {
          i18n: 'order',
        },
        component: 'views/util/sale/order',
        icon: 'icon-caidan',
        children: []
      },
    ]
  },
  {
    label: "财务管理",
    path: '/finance',
    meta: {
      i18n: 'finance',
    },
    icon: 'icon-caidan',
    children: [
      {
        label: "分成信息",
        path: 'share',
        meta: {
          i18n: 'share',
        },
        component: 'views/util/finance/share',
        icon: 'icon-caidan',
        children: []
      },
      {
        label: "提现信息",
        path: 'withdrawal',
        meta: {
          i18n: 'withdrawal',
        },
        component: 'views/util/finance/withdrawal',
        icon: 'icon-caidan',
        children: []
      },
    ]
  },
  {
    label: "权限管理",
    path: '/jurisdiction',
    meta: {
      i18n: 'jurisdiction',
    },
    icon: 'icon-caidan',
    children: [
      {
        label: "用户管理",
        path: 'usermanagement',
        meta: {
          i18n: 'usermanagement',
        },
        component: 'views/util/jurisdiction/usermanagement',
        icon: 'icon-caidan',
        children: []
      },
      {
        label: "角色管理",
        path: 'rolemanagement',
        meta: {
          i18n: 'rolemanagement',
        },
        component: 'views/util/jurisdiction/rolemanagement',
        icon: 'icon-caidan',
        children: []
      },
    ]
  },
  {
    label: "二维码设置",
    path: '/dimensional',
    meta: {
      i18n: 'dimensional',
    },
    icon: 'icon-caidan',
    children: [
      {
        label: "二维码生成",
        path: 'dimensionalcreate',
        meta: {
          i18n: 'dimensionalcreate',
        },
        component: 'views/util/dimensional/dimensionalcreate',
        icon: 'icon-caidan',
        children: []
      },
      {
        label: "酒店绑定",
        path: 'binding',
        meta: {
          i18n: 'binding',
        },
        component: 'views/util/dimensional/binding',
        icon: 'icon-caidan',
        children: []
      }
    ]
  },
]
const second = []
const third = [{
  label: "测试页面",
  path: '/test',
  component: 'views/test',
  icon: 'icon-caidan',
  meta: {
    i18n: 'test',
  },
  children: []
}]
export default ({ mock }) => {
  if (!mock) return;
  let menu = [first, second, third];
  Mock.mock('/user/getMenu', 'get', (res) => {
    let body = JSON.parse(res.body);
    return {
      data: menu[body.type] || []
    }
  })
  Mock.mock('/user/getTopMenu', 'get', () => {
    return {
      data: top
    }
  })

}